package cn.edu.scau.cmi.dengzejun.chapter09;

import java.util.*;

public class GetToken {
	String[] s;
	public String getToken(int index,String str) {
		StringTokenizer analysis = new StringTokenizer(str);
		int number = analysis.countTokens();
		s = new String[number + 1];
		int k = 1;
		while (analysis.hasMoreElements()) {
			String temp = analysis.nextToken();
			s[k] = temp;
			k++;
		}
		if (index <= number) {
			return s[index];
		}else {
			return null;
		}
	}
}
